import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import type { LoginInfo } from '@/api/model/adminLogin'

export const useCounterStore = defineStore('loginAdminInfo', () => {
	// 1.设置一个对象，用来存储用户的登录信息
	const loginAdmin = ref<LoginInfo>({})

	// 设置loginEmp对象数据
	const setLoginAdmin = (loginInfo : LoginInfo) => {
		loginAdmin.value = loginInfo
	}

	// 获取用户登录信息  --loginEmp对象数据
	const getLoginAdmin = () => {
		return loginAdmin.value
	}

	// 清除用户登录信息
	const removeLoginAdmin = () => {
		loginAdmin.value = {}
	}
	return { loginAdmin, setLoginAdmin, getLoginAdmin, removeLoginAdmin }
}, { persist: true })